
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db.models import *
from django.shortcuts import render
from rest_framework import permissions
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework.authentication import SessionAuthentication
from rest_framework_extensions.cache.mixins import CacheResponseMixin
from rest_framework.response import Response
from rest_framework import status
from rest_framework import mixins, viewsets
from rest_framework_extensions.cache.mixins import CacheResponseMixin
from rest_framework.pagination import PageNumberPagination
from rest_framework.permissions import IsAuthenticated
from django.forms.models import model_to_dict 
#from rest_framework.views import APIView
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters
import time
from datetime import datetime
from models import *
from serializer import *
from filters import * 
from datareport.models import *
import sys
reload(sys) 
sys.setdefaultencoding('utf8')


class customerPagination(PageNumberPagination):
    page_size = 2
    page_size_query_param = 'page_size'
    page_query_param = "page"
    max_page_size = 100


class RecordFileViewSet(mixins.UpdateModelMixin, mixins.ListModelMixin,mixins.RetrieveModelMixin, viewsets.GenericViewSet):
	pagination_class = customerPagination
	filter_backends = (DjangoFilterBackend,)	     
        filter_class  = RecordFileFilter 
        serializer_class = RecordFileSerializer
	def get_queryset(self):
	    #GenericAPIView 子类查询集的最简单方法是重写get_queryset()方法。
	    return RecordFile.objects.all()





